const http = require("http");
const fs = require("fs");

http.createServer((req,res)=>{
    if(req.url=="/"){
        var fileContent = fs.readFileSync("./get.html");
        res.writeHeader(200,{"Content-Type":"text/html;charset=uts-8"})
        res.write(fileContent);
        res.end();
    }else{
        var urlObj = new URL(req.url,"http://localhost:8081");
        //提取请求的参数
        var newsId = urlObj.searchParams.get("newsId");
        res.end("receive")
    }
}).listen(8081)